package base.domain;

import base.prototype.framework.Product;

/**
 * @program: DesignPatterns
 * @description: 打印三角形
 * @author: Mr.Dai
 * @create: 2018-05-28 21:47
 **/
public class Triangle implements Product {

    @Override
    public void use(int len) {
        for (int i = 0; i < len; i++) {
            for (int j = i; j < len; j++) {
                System.out.print(' ');
            }

            for (int j = 0; j < 2*i + 1; j++) {
                System.out.print('*');
            }
            System.out.println();
        }
    }

    @Override
    public Product createClone() {
        Product product=null;
        try {
            product=(Product)clone();
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
        }
        return product;
    }
}
